// 快速创建类组件
// 前提安装插件 ES7+React...

import React, { Component } from 'react'

export default class Mycls1 extends Component {
    constructor() {
        super()

    }
    render() {
        const prolist = [
            {
                id: 1,
                name: '手机'
            },
            {
                id: 2,
                name: '冰箱'
            },
            {
                id: 3,
                name: '洗衣机'
            }
        ]
        return (
            <div>
                <ul>
                    {
                        prolist.map((item, index) => {

                            {/* <li key={item.id} onClick={this.handleClick.bind(this, item.id)}>{item.id}--{item.name}</li> */ }
                            return <li key={item.id} onClick={() => { this.handleClick(item.id) }}>{item.id}--{item.name}</li>
                        })
                    }
                </ul>
            </div>
        )
    }
    handleClick(id) {
        console.log(this);
        console.log(id);
    }
}

